function createAnimation(options) {
    var from = options.from;
    var to = options.to;
    var totalMS = options.totalMS || 1000;
    var duration = options.duration || 10;
    var times = Math.floor(totalMS / duration);// 变化总次数
    var dis = (to - from) / times;// 每次变化的距离
    var curTime = 0;// 当前变化到第几次了
    var timer = setInterval(() => {
        from += dis;
        curTime++;
        if (curTime > times) {// 变化次数到了，更新参数
            from = to;
            options.onEnd && options.onEnd();
            clearInterval(timer);

        }
        // 要改变的高度/宽度/位置等
        if (curTime <= times) {
            options.onMove && options.onMove(from);
        }

    }, duration);
}
// createAnimation({
//     from: 120,
//     to: 0,
//     totalMS: 500,
//     duration: 10,
//     onMove: function (n) {
//         console.log("回调函数：" + n);
//     },
//     onEnd: function () {
//         console.log("结束了")
//     }
// });